<template>
  <div>
    <el-button @click="currentComponent = 'Login'">a</el-button>
    <el-button @click="currentComponent = 'Reg'">b</el-button>
    <keep-alive>
    <component :is="currentComponent"></component>
    </keep-alive>
  </div>
</template>

<script>
import Login from './Login'
import Reg from './Reg'
export default {
  components:{Login,Reg},
    data(){
      return {
         currentComponent:"Login"
      }
    }
}
</script>

<style>

</style>